<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
     <title>麦包郎</title>

    <!-- Bootstrap -->
    <link href="<%=basePath%>bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="<%=basePath%>bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
    <link href="<%=basePath%>assets/styles.css" rel="stylesheet" media="screen">
    <link href="<%=basePath%>assets/DT_bootstrap.css" rel="stylesheet" media="screen">
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="vendors/flot/excanvas.min.js"></script><![endif]-->
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="<%=basePath%>vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style>
        #contentjun{
            margin-left: 25%;
        }

        .block1{
            position: relative;
        }
        .block1 .btn-toolbar{
            position: absolute;
            top: -4px;
            right: -5%;
            width: 200px;
        }
        .block{
            position: relative;
        }
        .block .btn-toolbar{
            position: absolute;
            top: -4px;
            right: -5%;
            width: 200px;
        }
        .ss{
            width: 280px;
            position: relative;
            top: 37px;
            left: 63%;
        }

        #example2_filter label{
            display: none;
        }
    </style>
  </head>
  
  <body>
  <%
    if(request.getSession().getAttribute("acc") == null) {
        response.sendRedirect("../emp/adminLogin");
    }
%>
  <div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container-fluid">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
            <a class="brand">麦包郎后台管理系统</a>
            <div class="nav-collapse collapse">

                <ul class="nav">


                    <li class="dropdown">

                        <ul class="dropdown-menu">
                            <li>
                                <a tabindex="-1" href="#">用户列表</a>
                            </li>
                            <li>
                                <a tabindex="-1" href="#">搜索</a>
                            </li>
                            <li>
                                <a tabindex="-1" href="#">权限</a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
            <!--/.nav-collapse -->
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span3" id="sidebar">
            <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                <li>
					<a href="<%=basePath%>emp/getAll"><i class="icon-chevron-right"></i> 店铺管理</a>
				</li>
					
				<li>
					<a href="<%=basePath%>shop/today"><i class="icon-chevron-right"></i>今日订单 </a>
				</li>

				<li>
					<a href="<%=basePath%>ord/selectli"><i class="icon-chevron-right"></i> 历史订单</a>
				</li>

						
				<li>
					<a href="<%=basePath%>commodity/tong"><i class="icon-chevron-right"></i>食材管理</a>
				</li>
				<li class="active">
					<a href="<%=basePath%>ord/caiwu"><i class="icon-chevron-right"></i>财务管理</a>
				</li>

            </ul>
        </div>
        <!--/span-->
        <div class="span9" id="content">


            <div class="row-fluid">
                <!-- block -->
                <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">财务详情</div>
                       <div style="height:15px; margin-left: 10px;"  class="btn btn-info">
                           <p style="position: relative;top: -5px;">总计：<span><fmt:formatNumber type="number" value="${total}" maxFractionDigits="1"/>元</span></p>
                       </div>

                    </div>
                    <div class="block-content collapse in">
                        <div class="span12">
                            <div class="table-toolbar">


                            </div>
                            <!--startprint-->
                            <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example2">
                            
                                <thead>
                                <tr>
                                    <th>店铺名称</th>
                                    <th>地址</th>
                                    <th>期望送达时间</th>
                                    <th>电话</th>
                                    <th>订货清单</th>
                                    <th>总计</th>

                                    <th >操作</th>

                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${today}" var="to">
                                <tr class="odd gradeX">
                                    <td>${to.key.name}</td>
                                    <td>${to.key.address}</td>
                                    <td>${to.key.time}</td>
                                    <td>${to.key.phone}</td>
                                    <td class="center">
                                    <ul style="list-style: none;">
	                                    <c:forEach items="${to.value}" var="shang">
	                                    	<li>${shang.name}×${shang.num}</li>
	                                    </c:forEach>
                                    	
                                    </ul>
                                    </td>
                                    <td class="center"><fmt:formatNumber type="number" value="${to.key.total}" maxFractionDigits="1"/>元</td>



                                        <!--<button class="btn btn-danger">打印</button></td>-->
                                    <td class="center">
										<span id="fa${to.key.ordid}">
                                        <c:if test="${to.key.state==2}"><button class="btn btn-danger"  onclick="fa(${to.key.ordid})" >确认发货</button></c:if>
                                        <c:if test="${to.key.state==3}">已取消</c:if>
                                        <c:if test="${to.key.state==1}">未确认</c:if>
                                        <c:if test="${to.key.state==4}">已发货</c:if>
                                    	<span style="display: none" class="btn btn-danger">已发货</span>
									</span>
                                    <%-- <button class="btn btn-danger" onclick="shan(${to.key.ordid})">删除订单</button> --%>
                                    </td>
                                </tr>
								</c:forEach>

                                </tbody>
                            </table><!--endprint-->
                        </div>
                   </div>
                </div>
                <!-- /block -->
            </div>
        </div>
    </div>
    <hr>

</div>
<!--/.fluid-container-->

<!--/.fluid-container-->
<div class="span9" id="contentjun">


    <div class="row-fluid">
        <!-- block -->
        <div class="block">
            <div id="junjun2" class="navbar navbar-inner block-header">
                <div class="muted pull-left">清单统计</div>
 <div style="height:15px; margin-left: 10px;"  class="btn btn-info">
                           <p style="position: relative;top: -5px;">价钱总计：<span><fmt:formatNumber type="number" value="${total}" maxFractionDigits="1"/>元</span></p>
                       </div>

            </div>
            <div class="block-content collapse in">
                <div class="span12">
                    <div class="table-toolbar">


                    </div>
                    <!--startprint-->
                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example2">
                        <thead>
                         <tr>
                            <th>商品名称</th>
                            <th>数量</th>
                        </tr>
                        
                        
                        </thead>
                        <tbody>
                        <c:forEach items="${comList}" var="com">
                        	<tr class="odd gradeX">
                            <td>${com.name}</td>
                            <td>${com.num}</td>
                            
                        </tr>
                        </c:forEach>


                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- /block -->

<script src="<%=basePath%>vendors/jquery-1.9.1.js"></script>
<script src="<%=basePath%>bootstrap/js/bootstrap.min.js"></script>
<script src="<%=basePath%>vendors/datatables/js/jquery.dataTables.min.js"></script>


<script src="<%=basePath%>assets/scripts.js"></script>
<script src="<%=basePath%>assets/DT_bootstrap.js"></script>

<script>window.jQuery || document.write('<script src="js/jquery-1.11.0.min.js"><\/script>')</script>
<script src="<%=basePath%>js/blob.js"></script>
<script src="<%=basePath%>js/xlsx.core.min.js"></script>
<script src="<%=basePath%>js/FileSaver.min.js"></script>
<script src="<%=basePath%>js/tableexport.js"></script>

<script type="text/javascript">
    $(function(){
        $(".block").tableExport({formats:["xlsx"]});
        $(".block1").tableExport({formats:["xlsx"]});
    })
</script>
<script>
    function doPrint() {
        // 获得body的html
        bdhtml=window.document.body.innerHTML;
        // 打印开始的标志
        sprnstr="<!--startprint-->";
        // 打印结束的标志
        eprnstr="<!--endprint-->";
        // 从打印开始的位置截取到末尾
        prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17);
        // 从开始截取到打印结束的位置
        prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));
        // 替换html
        window.document.body.innerHTML=prnhtml;
        // 打印
        window.print();
    }
    
    function fa(id){
    	//window.location.href="ord/fa?id="+id; 
    	 $.ajax({
             type: "GET",
             url: "ord/fahuo",
             data: {id:id},
             dataType: "json",
             success: function(data){
                //var json=eval("("+data+")");
                //alert(data.id); 
               if(data==1){
            	   $("#fa"+id).html("已发货");
               }else{
					alert("删除失败");
               }
         	 }
         });
    }
    
    function shan(id){
    	window.location.href="ord/deleteOrd?id="+id+"&pan=2"; 
    }
</script>
  </body>
</html>
